Connectivity Software User's Guide and Reference
QuickOPC REALbasic (Xojo) Examples
QuickOPC > Examples > QuickOPC Examples > QuickOPC COM Examples > QuickOPC REALbasic (Xojo) Examples
In This Topic

General

Note: We do not regularly update these examples with new versions. You may have to modify the code to use newer versions.

The REALbasic (Xojo) examples were originally created in REAL Studio 2010r5, and converted to REAL Studio 2011r1.1, and later versions. We also tested with Xojo 2019r3.1 and Xojo 2020r1.2.

The features decribed or used here are only available if you included "COM development" during the installation of Connectivity Software. If the features are missing, simply re-run the installation program, making sure that "COM development" is included in the selection made on the "Installation Dashboard" setup wizard page.

Where are the examples?

The examples are available in multiple formats and on different locations. You can pick the one that suits you the best.

Xojo Development Specifics

It appears to be impossible to enumerate COM collections using any built-in construct, or accessing the GetEnumerator method in Xojo. With most collections, you can, however, obtain the Count property of the collection, and then access the individual elements using the Item property, which is "indexed" by an integer, from 0 to Count - 1.

Some collections in QuickOPC are, however, keyed collections, where the key is not an integer (or it might be an integer but it does not represent a sequential index into the collection). There is no direct way to enumerate elements of such keyed collections in Xojo.

To enumerate such collections, we recommend following workaround: Create an instance of ElasticVector Collection object, and call its AddRange Method, passing it the keyed collection you want to enumerate. This will effectively convert the key collection to an elastic vector, and you can then use the Item Property of the elastic vector (indexed by an integer) to access all elements of the original collection in a sequence.

With Multiple-operation Methods, it is highly recommended that you use the methods that accept and return lists (as opposed to arrays). Significant memory leaks have been observed when arrays from QuickOPC are returned to Xojo.
In tight loops involving operations on COM components (in single-threaded apartments, which appears to be the default), your code should pump Windows messages, e.g. by calling App.DoEvents periodically.
See Also

Examples

Knowledge Base

Examples - Client OPC Data Access

QuickOPC